<?php $this->headTitle('Управление пользователями'); ?>

<div id="strlist">
    <div class="strecord">
        <div class="theme">Управление пользователями</div>
        <?php if (!empty($this->messages)) { ?>
        <div class="messages">
            <?php foreach($this->messages as $message) {
                    echo $message . '<br>';
                } ?>
        </div>
        <?php } ?>
        <table>
        <tr>
        <th>Username</th>
        <th>Login</th>
        <th>Тип</th>
        <th>Дата регистрации</th>
        <th>Активность</th>
        <th></th>
        <th></th>
        </tr>
        <?php 
        $classTr = 'odd';
        foreach ($this->paginator as $user)
        { ?>
        <tr class="<?php echo $classTr ?>"><?php
            if (isset($this->distinctUser[$user->user_id])) {
            ?>
            <td style="background-color: #222;"><a href="<?php
            echo $this->url(array('id' => $user->user_id), 'author');
        ?>" class="author"><?php
            echo $user->username ?></a></td>
            <?php } else { ?>
            <td style="background-color: #222;"><?php echo $user->username ?></td>
            <?php } ?>
        <td><?php echo $user->login ?></td>
        <td><?php echo $user->user_type ?></td>
        <td><?php echo $this->dateTimeFormat($user->time_created) ?></td>
        <td><?php echo $this->dateTimeFormat($user->time_last) ?></td>
        <td><a href="<?php echo $this->url(array('id' => $user->user_id),
                                           'editUser'); ?>">Edit</a></td>
            
        <?php if ($user->user_id != 1) : ?>
        <td><a href="<?php echo $this->url(array('id' => $user->user_id),
                                          'deleteUser') ?>">Delete</a></td>
        <?php else : ?>
        <td>Delete</td>
        <?php endif; ?>
        </tr>
        <?php
            $classTr = ($classTr == 'odd') ? 'even' : 'odd';
        } ?>
        </table>
    </div>
    <?php echo $this->paginationControl($this->paginator, 'Elastic', 'main_paginator.phtml'); ?>
</div>
